import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/home/home.vue')
  },
  {
    path: '/city',
    name: 'city',
    component: () => import('@/views/city/City.vue')
  },
  {
    path: '/detail/:id',
    name: 'deyail',
    component: () => import('@/views/detail/detail.vue')
  }
]

const router = new VueRouter({
  routes,
  scrollBehavior (to, from, savedPosition) {
    // return 期望滚动到哪个的位置
    return { top: 0 }
  }
})

export default router
